<?php
namespace app\admin\controller;
use think\Controller;
class Storeorder extends Base
{
    // 页面展示
    public function index()
    {
        $list = db('eb_store_order')->paginate(5);
        $data = $list->items();
        $this->assign('list',$list);
        $this->assign('data',$data);
        return $this->fetch();
    }

    // 备注
    public function remark(){
        return $this->fetch();
    }

    // 记录
    public function record(){
        $list = db('eb_store_order_status')->paginate(5);
        $data = $list->items();
        $this->assign('list',$list);
        $this->assign('data',$data);
        return $this->fetch();
    }

    // 订单修改
    public function edit(){
        $id  = input( 'id' );
        if(request()->isPost()){
            if( !$id ) {
                $this->error( '非法操作' );
            }else{
                $data = input();
                $Classify = model('status');
                if( $Classify->edit( $id,$data ) ) {
                    $this->success( '编辑成功', url( 'Storeorder/index' ) );
                } else {
                    $this->error( '编辑失败' , url( 'Storeorder/edit' ));
                }
            }
        }else{
            $find  = db( 'eb_store_order' )->where( ['id'=>$id] )->find();
            $this->assign( 'find', $find );
            return $this->fetch();
        }
    }
}
